#pragma once
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include "UILayer.h"
#include "SampleSelector.h"
struct WindowParam {
	WindowParam(std::string name = "Animation", int width = 1280, int height = 960, bool isFullScreen = true)
		: name(name), width(width), height(height), isFull(isFullScreen) {}
	std::string name;
	int width;
	int height;
	bool isFull;
};


class Application {
public:
	~Application();

	static Application* GetInstance();
	
	void Init(WindowParam param,SampleBase* sample);
	void Run();

	GLFWwindow* GetWinowHandle() { return mWindowHandle; }
	int GetHeight() const { return mWindowParam.height; }
	int GetWidth() const { return mWindowParam.width; }
private:
	Application();
	bool CreateWindow();
	void DestroyWindow();
private:
	GLFWwindow* mWindowHandle = nullptr;
	UILayer* mUILayer = nullptr;
	WindowParam mWindowParam;
	static Application* msInstance;
	SampleBase* sample = nullptr;
	bool mIsRunning = false;
	ImVec4 clear_color = ImVec4(1.0f,1.0f,1.0f, 1.000f);
	double currTime = 0.0f, preTime = 0.0f;
};





